package Application;
//animal抽象类
abstract class Animal{
	public abstract void cry();
	public abstract String getAnimalName();
}
//模拟器Simulator
class Simulator{
	public void playSound(Animal animal) {
		animal.cry();
		System.out.println("动物品种:"+animal.getAnimalName());
	}
}
//Animal Dog类
class Dog extends Animal{
	public void cry() {
		System.out.println("狗:汪汪汪!");	
	}
	public String getAnimalName() {
		return "狗";
	}
}
//Animal Cat类
class Cat extends Animal{
	public void cry() {
		System.out.println("猫:喵喵喵!");
	}
	public String getAnimalName() {
		return "猫";
	}
}


//主类 Appication
public class Application {
	public static void main(String[]args) {
		Simulator simulator=new Simulator();
		simulator.playSound(new Dog());
		simulator.playSound(new Cat());
	}

}
